//
//  YBBodyFatModel.m
//  孕妙
//
//  Created by Raoy on 16/6/12.
//  Copyright © 2016年 是源科技. All rights reserved.
//

#import "YBBodyFatModel.h"
#import "YBCreateTime.h"
@implementation YBBodyFatModel
- (void)setDate:(YBCreateTime *)date
{
    _date = date;
//    NSDateComponents * dateCom = [_date objectForKey:@"time"];
    
    
//    NSDateFormatter* formatter = [[NSDateFormatter alloc] init];
//    [formatter setDateStyle:NSDateFormatterMediumStyle];
//    [formatter setTimeStyle:NSDateFormatterShortStyle];
//    [formatter setDateFormat:@"yyyyMMddHHMMss"];
//    NSDate *date = [NSDate dateWithTimeIntervalSince1970:[date.time doubleValue] / 1000];//NSTimeInterval
//    NSCalendar *cal = [NSCalendar currentCalendar];
//    NSUInteger unit = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitWeekOfMonth | NSCalendarUnitWeekday;
//    _time = [cal components:unit fromDate:date];
//    NSLog(@"date == %@", _time);
//    NSLog(@"dateStr == %@", [formatter stringFromDate:date]);
    
    _date = date;
    NSDate *tempDate = [NSDate dateWithTimeIntervalSince1970:date.time];
    NSCalendar *cal = [NSCalendar currentCalendar];
    NSUInteger unit = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitWeekOfMonth | NSCalendarUnitWeekday;
    _parmaterDateCom = [cal components:unit fromDate:tempDate];

    NSLog(@"%@", _parmaterDateCom);
}

@end
